Skip to content

Implement model for String.equals #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2018

Conversation

codebyzeb
Copy link
Contributor

String.equals is currently handled internally by CBMC, here we update
the model so that String.equals is supported when we move support
to models-library.

@@ -1393,8 +1393,10 @@ else if(c<=0xFFFF)
* @diffblue.untested
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this tagged untested?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@codebyzeb codebyzeb force-pushed the zgoriely/string-equals branch 2 times, most recently from ce59649 to 66202de Compare July 20, 2018 15:27
@romainbrenguier romainbrenguier force-pushed the zgoriely/string-equals branch from 66202de to c77e6a1 Compare August 2, 2018 09:49
@@ -1611,7 +1612,7 @@ public int compareTo(String anotherString) {
// DIFFBLUE MODEL LIBRARY For some reason this needs to be not null for
// FileReader tests to pass.
public static final Comparator<String> CASE_INSENSITIVE_ORDER
= CProver.nondetWithoutNullForNotModelled();
= null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment directly above needs to be updated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why this change is necessary or related to this PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some JBMC tests fail because the type on the left and right correspond (for jbmc). This wasn't a problem before but if we load the model of String.java for using String.equals this also gets loaded.

@@ -1611,7 +1612,7 @@ public int compareTo(String anotherString) {
// DIFFBLUE MODEL LIBRARY For some reason this needs to be not null for
// FileReader tests to pass.
public static final Comparator<String> CASE_INSENSITIVE_ORDER
= CProver.nondetWithoutNullForNotModelled();
= null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why this change is necessary or related to this PR?

*/
public boolean equals(Object anObject) {
// DIFFBLUE MODEL LIBRARY This is treated internally in CBMC
return CProver.nondetBoolean();
if (anObject instanceof String) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in the models-lib PR, could you add the original code from the JDK, commented out?

// }
// return false;

// DIFFBLUE MODEL LIBRARY Use CProverString function

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛏️ In the other PR, it says "method" instead of "function".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected in the other PR

String.equals is currently handled internally by CBMC, here we update
the model so that String.equals is supported when we move support
to models-library.
@romainbrenguier romainbrenguier merged commit c9d9226 into master Oct 1, 2018
@allredj allredj deleted the zgoriely/string-equals branch October 1, 2018 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants